package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SpecificationCategoryMapper;
import com.ruoyi.system.domain.SpecificationCategory;
import com.ruoyi.system.service.ISpecificationCategoryService;

/**
 * 规格分类 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-24
 */
@Service
public class SpecificationCategoryServiceImpl implements ISpecificationCategoryService
{
    @Autowired
    private SpecificationCategoryMapper specificationCategoryMapper;

    /**
     * 通过id查询规格分类
     *
     * @param id 规格分类主键
     * @return 规格分类
     */
    @Override
    public SpecificationCategory selectSpecificationCategoryById(Long id)
    {
        return specificationCategoryMapper.selectSpecificationCategoryById(id);
    }

    /**
     * 通过规格分类名称查询规格分类列表
     *
     * @param specCategoryName 规格分类名称
     * @return 规格分类
     */
    @Override
    public List<SpecificationCategory> selectSpecificationCategoryListByName(String specCategoryName)
    {
        return specificationCategoryMapper.selectSpecificationCategoryListByName(specCategoryName);
    }

    /**
     * 新增规格分类
     *
     * @param specificationCategory 规格分类
     * @return 结果
     */
    @Override
    public int insertSpecificationCategory(SpecificationCategory specificationCategory)
    {
        return specificationCategoryMapper.insertSpecificationCategory(specificationCategory);
    }

    /**
     * 修改规格分类
     *
     * @param specificationCategory 规格分类
     * @return 结果
     */
    @Override
    public int updateSpecificationCategory(SpecificationCategory specificationCategory)
    {
        specificationCategory.setUpdateTime(DateUtils.getNowDate());
        return specificationCategoryMapper.updateSpecificationCategory(specificationCategory);
    }

    /**
     * 通过id批量删除规格分类信息
     *
     * @param ids 需要删除的规格分类主键
     * @return 结果
     */
    @Override
    public int deleteSpecificationCategoryByIds(Long[] ids)
    {
        return specificationCategoryMapper.deleteSpecificationCategoryByIds(ids);
    }

    /**
     * 通过id删除规格分类信息
     *
     * @param id 规格分类主键
     * @return 结果
     */
    @Override
    public int deleteSpecificationCategoryById(Long id)
    {
        return specificationCategoryMapper.deleteSpecificationCategoryById(id);
    }
}
